-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically add "restart" commands for language servers #3215
Conversation
@@ -112,6 +112,10 @@ export abstract class BaseLanguageClientContribution implements LanguageClientCo | |||
})); | |||
} | |||
}, options); | |||
|
|||
this.registerRestartCommand(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be available only if the server actually running, i.e. like in typescript extension right now.
We also need to remove an existing command from the typescript extension to avoid duplicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be available only if the server actually running, i.e. like in typescript extension right now.
This is what this code does, doesn't it? activate
is only called when starting the language client/server.
We also need to remove an existing command from the typescript extension to avoid duplicate.
Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the language server stops, we should remove the command, but I don't know how to make a language server stop for good.
protected registerRestartCommand(): void { | ||
this.registry.registerCommand({ | ||
id: this.restartCommandId(), | ||
label: `Restart ${this.name} language server`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe {this.name}: Restart Server
to align with other commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I changed it to ${this.name}: Restart Language Server
.
d6f25eb
to
82523a0
Compare
New version uploaded. |
@@ -83,11 +79,6 @@ export class TypeScriptFrontendContribution implements CommandContribution, Menu | |||
isEnabled: () => !!this.clientContribution.logFileUri, | |||
isVisible: () => !!this.clientContribution.logFileUri | |||
}); | |||
commands.registerCommand(TypeScriptCommands.restartServer, { | |||
execute: () => this.clientContribution.restart(), | |||
isEnabled: () => this.clientContribution.running, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could implement isEnabled
and isVisible
in the same way for generic restart command that it is not visible while a server is restarting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried with TS and JSON, works good
Although the command is visible even when the server is not running, i.e during restart itself, see https://github.com/theia-ide/theia/pull/3215/files#r228837246
It is quite common (though not desirable) to have to restart a language server, because it misbehaves or doesn't pick up new settings properly. This patch registers Theia commands for each started language server. Change-Id: I567e6e9851ef1b68198d0ac9b25aa9926213d6f9 Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
82523a0
to
83ac80b
Compare
Updated. Please merge when you are happy with it (according to @marcdumais-work's interpretation of the Eclipse rules, only committers of the soon-to-be Eclipse project should press the merge button). |
It is quite common (though not desirable) to have to restart a language
server, because it misbehaves or doesn't pick up new settings
properly. This patch registers Theia commands for each started language
server.
Change-Id: I567e6e9851ef1b68198d0ac9b25aa9926213d6f9
Signed-off-by: Simon Marchi simon.marchi@ericsson.com